home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / gnu / diff_2_1.lha / diff-2.1 / system.h < prev    next >
C/C++ Source or Header  |  1993-02-03  |  3KB  |  153 lines

  1. /* System dependent declarations.
  2.    Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU DIFF.
  5.  
  6. GNU DIFF is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU DIFF is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU DIFF; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include <sys/types.h>
  21. #include <sys/stat.h>
  22.  
  23. #ifndef S_ISDIR
  24. #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
  25. #endif
  26. #ifndef S_ISREG
  27. #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
  28. #endif
  29.  
  30. #if HAVE_UNISTD_H
  31. #include <unistd.h>
  32. #endif
  33.  
  34. #if HAVE_TIME_H
  35. #include <time.h>
  36. #else
  37. #include <sys/time.h>
  38. #endif
  39.  
  40. #if HAVE_FCNTL_H
  41. #include <fcntl.h>
  42. #else
  43. #include <sys/file.h>
  44. #endif
  45.  
  46. #if !HAVE_DUP2
  47. #define dup2(f,t)    (close (t),  fcntl (f,F_DUPFD,t))
  48. #endif
  49.  
  50. #ifndef O_RDONLY
  51. #define O_RDONLY 0
  52. #endif
  53.  
  54. #if HAVE_SYS_WAIT_H
  55. #ifndef _POSIX_VERSION
  56. /* Prevent the NeXT prototype using union wait from causing problems.  */
  57. #define wait system_wait
  58. #endif
  59. #include <sys/wait.h>
  60. #ifndef _POSIX_VERSION
  61. #undef wait
  62. #endif
  63. #endif /* HAVE_SYS_WAIT_H */
  64.  
  65. #ifndef WEXITSTATUS
  66. #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  67. #undef WIFEXITED        /* Avoid 4.3BSD incompatibility with Posix.  */
  68. #endif
  69. #ifndef WIFEXITED
  70. #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  71. #endif
  72.  
  73. #if HAVE_ST_BLKSIZE
  74. #define STAT_BLOCKSIZE(s) (s).st_blksize
  75. #else
  76. #define STAT_BLOCKSIZE(s) (S_ISREG ((s).st_mode) ? 8192 : 4096)
  77. #endif
  78.  
  79. #if DIRENT || defined (_POSIX_VERSION)
  80. #include <dirent.h>
  81. #ifdef direct
  82. #undef direct
  83. #endif
  84. #define direct dirent
  85. #else /* ! (DIRENT || defined (_POSIX_VERSION)) */
  86. #if SYSNDIR
  87. #include <sys/ndir.h>
  88. #else
  89. #if SYSDIR
  90. #include <sys/dir.h>
  91. #else
  92. #include <ndir.h>
  93. #endif
  94. #endif
  95. #endif /* ! (DIRENT || defined (_POSIX_VERSION)) */
  96.  
  97. #if HAVE_VFORK_H
  98. #include <vfork.h>
  99. #endif
  100.  
  101. #if HAVE_STRING_H || STDC_HEADERS
  102. #include <string.h>
  103. #ifndef AMIGA
  104. #define index    strchr
  105. #define rindex    strrchr
  106. #define bcopy(s,d,n)    memcpy (d,s,n)
  107. #define bcmp(s1,s2,n)    memcmp (s1,s2,n)
  108. #define bzero(s,n)    memset (s,0,n)
  109. #endif /* !AMIGA */
  110. #else
  111. #include <strings.h>
  112. #endif
  113. #if !HAVE_MEMCHR || !STDC_HEADERS
  114. char *memchr ();
  115. #endif
  116.  
  117. #if STDC_HEADERS
  118. #include <stdlib.h>
  119. #include <limits.h>
  120. #else
  121. char *getenv ();
  122. char *malloc ();
  123. char *realloc ();
  124. #if __STDC__ || __GNUC__
  125. #include "limits.h"
  126. #else
  127. #define INT_MAX 2147483647
  128. #define CHAR_BIT 8
  129. #endif
  130. #endif
  131.  
  132. #include <errno.h>
  133. #if !STDC_HEADERS
  134. extern int errno;
  135. #endif
  136.  
  137. #ifdef TRUE
  138. #undef TRUE
  139. #endif
  140. #ifdef FALSE
  141. #undef FALSE
  142. #endif
  143. #define TRUE        1
  144. #define    FALSE        0
  145.  
  146. #if !__STDC__
  147. #define const
  148. #define volatile
  149. #endif
  150.  
  151. #define min(a,b) ((a) <= (b) ? (a) : (b))
  152. #define max(a,b) ((a) >= (b) ? (a) : (b))
  153.